import { request } from 'umi';

/**
 * 获取文章列表
 */
export async function getArticleLists(params) {
  return request('/api/admin/article', {
    method: 'GET',
    params
  });
}

/**
 * 文章取消关联商品
 */
export async function cancelGoods(article){
  return request(`/api/admin/unrelation/${article}`,{
    method:'GET'
  })
}

/**
 * 文章关联商品
 */
export async function relationGoods(params,article){
  return request(`/api/admin/relation/${article}`,{
    method:'GET',
    params
  })
}

/**
 * 文章删除的接口
 */

export async function deleteArticle(article){
  return request(`/api/admin/article/${article}`,{
    method:'DELETE',
  })
}

/**
 * 添加文章的接口
 */
export async function addArticle(data){
  return request('/api/admin/article',{
    method:'POST',
    data
  })
}

/**
 * 获取文章分类列表
 */
export async function getArticleClassify(){
  return request('/api/admin/article_category',{
    method:'GET',
  })
}

/**
 * 控制文章分类的状态
 */
export async function ArticleStatus(article_category,data){
  return request(`/api/admin/article_category/status/${article_category}`,{
    method:'PUT',
    data
  })
}

/**
 * 删除文章分类的接口
 */
export async function deleteCategoryClassify(article_category){
  return request(`/api/admin/article_category/${article_category}`,{
    method:'DELETE'
  })
}

/**
 * 添加文章分类的接口
 */
export async function addClassify(data){
  return request('/api/admin/article_category',{
    methods:'POST',
    data
  })
}
